/*
 * @Author: GL
 * @Date: 2022-10-10 23:58:56
 * @LastEditors: GL
 * @LastEditTime: 2022-10-13 17:03:40
 * @Description: 文章管理
 */
const express = require('express')
const articleData = require('../router_handler/article')

// 校验
// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入文章分类的验证模块
const { add_cate_schema , delete_cate_schema , search_cate_schema , update_cate_schema} = require('../schema/article')

// 创建路由实例
const router = express.Router()

// 获取文章信息
router.get('/article',articleData.article)

// 新增文章信息
router.post('/addarticle',expressJoi(add_cate_schema),articleData.addArticle)

// 删除文章
router.get('/delarticle/:id',expressJoi(delete_cate_schema),articleData.delArticle)

// 文章搜索
router.get('/searcharticle',expressJoi(search_cate_schema),articleData.searchArticle)

// 文章更新
router.post('/updatearticle',expressJoi(update_cate_schema),articleData.updateArticle)

module.exports = router